package com.cjy.appIndexHeaderFlash.action;

import com.base.common.action.AbstractBaseAction;
import com.base.common.bean.ActionResult;
import com.cjy.appIndexHeaderFlash.service.AppIndexHeaderFlashService;
import com.cjy.common.bean.OpAttributes;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import javax.annotation.Resource;

import static com.base.GlobaConstants.*;

@Action("appIndexHeaderFlashAction")
@Results({ @Result(name = ASYNCHRONOUS, type = JSON, params = { ROOT,
		ACTION_RESULT_DATA, CONTENT_TYPE, CONTENT_TYPE_JSON }) })
public class AppIndexHeaderFlashAction extends AbstractBaseAction {

	private static final long serialVersionUID = 1L;
	
	@Resource
	private AppIndexHeaderFlashService appIndexHeaderFlashService;

	private int bid;
	public int getBid() {
		return bid;
	}

	public void setBid(int bid) {
		this.bid = bid;
	}

	public String queryAll() {
		try {
			actionResult = ActionResult.getActionResult(new OpAttributes().add("code", 1)
					.add("result", appIndexHeaderFlashService.queryAll(bid)));
		} catch (Exception e) {
			e.printStackTrace();
			actionResult = ActionResult.getActionResult(new OpAttributes().add("code", 0));
		}
		return returnType();
	}

}
